package com.foton.limiter.construstlimiter.controller;

import com.foton.limiter.construstlimiter.base.config.NotifyServiceManager;
import com.foton.limiter.construstlimiter.base.config.TransObserManager;
import com.foton.limiter.construstlimiter.base.config.ValidatorManager;
import com.foton.limiter.construstlimiter.base.notify.NotifyType;
import com.foton.limiter.construstlimiter.base.validator.TransferRequest;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author RenPu
 * @Date 2023/3/20 10:26
 * @Version 1.0
 * @Description:
 **/
@RestController
@AllArgsConstructor
public class TestController {

   private final ValidatorManager validatorManager;
   private final NotifyServiceManager notifyServiceManager;
   private final TransObserManager transObserManager;

    @RequestMapping("/limiter")
    public String testLimiter(){

        return "Welcome to Limiter ! ! ! !";
    }

    @RequestMapping("/acid")
    public String test(@RequestParam("userId") String userId,
                       @RequestParam("code") Integer code){
        validatorManager.checkParam(TransferRequest.builder().Moneparam("10000").NOparam(5).build());
        String content="欢迎使用设计模式,进行代码重构！！！！！";
        notifyServiceManager.notifyR(code,userId,content);
        transObserManager.notifyObser(content);
        return "执行成功==========";
    }




}
